package com.jdk.demo.queue.synchronousQueue;

import java.util.concurrent.SynchronousQueue;

public class Consumer implements Runnable {

	private SynchronousQueue<String> sc;

	public Consumer(SynchronousQueue<String> sc) {
		super();
		this.sc = sc;
	}

	@Override
	public void run() {
		while (true) {
            try {
                System.out.println("-----------------> sc.take: " + sc.take());
                System.out.println("-----------------> 获取操作运行完毕...");//是操作完毕，并不是添加或获取元素成功!
                Thread.sleep(1000);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
	}

}
